package com.freejy.ecommunity.service;

import java.util.List;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.alibaba.fastjson.JSONObject;
import com.freejy.ecommunity.mapper.GameInfoMapper;
import com.freejy.ecommunity.model.GameInfo;

@Service
public class GameInfoService {

    private final Logger log = LoggerFactory.getLogger(GameInfoService.class);
    

    @Autowired
    private GameInfoMapper gameInfoMapper;
    

    /**
     * 根据登陆名查询
     * @param account
     * @return
     * @throws Exception
     */
	public List<GameInfo> getGameInfo() throws Exception
    {
		
		
		
		return gameInfoMapper.getGameInfo();
	}

	public JSONObject getHomePageGameInfo() throws Exception
    {
		JSONObject json =new JSONObject();
		
		json.put("banner", gameInfoMapper.getGameInfoByTag("1"));
		
		json.put("recommend", gameInfoMapper.getGameInfoByTag("2"));
		
		json.put("weekhot", gameInfoMapper.getGameInfoByTag("3"));
		return json;
	}
	
	
	public int insert(GameInfo gameInfo){
		return gameInfoMapper.insert(gameInfo);
	}
	
}
